/**
 * 
 */
package se.ricardo.gamesorgs.api.request;


/**
 * Class for storing the values entered by the user in the
 * JDialog add/edit form.
 * <br>
 * 
 * @author Ricardo Ocaña Leal
 *
 */
public class AddGameRequest extends AbstractRequest {
	private String title;
	private String cart;
	private String instructions;
	private String box;
	private String comment;
	
	/**
	 * Initialize variables with default values.
	 * */
	public AddGameRequest(
			String title,
			String company,
			String system,
			String cart,
			String instructions,
			String box,
			String comment,
			int listType) {
		super(company, system, listType);
		
		this.title = title;
		this.cart = checkEmptyValue(cart);
		this.instructions = checkEmptyValue(instructions);
		this.box = checkEmptyValue(box);
		this.comment = checkEmptyValue(comment);
	}
	
	/**
	 * Helper method for fields that are allowed to be empty.
	 * Sets the value to null if it's an empty String.
	 * <br>
	 * 
	 * @param
	 * s The String to check.
	 * <br>
	 * 
	 * @return
	 * Either null if the String is empty or the String.
	 * */
	private String checkEmptyValue(String s) {
		if(s != null) {
			return s.equals("") ? null : s;
		}
		
		return s;
	}
	
	/**
	 * Returns the name of the game.
	 * <br>
	 * 
	 * @return
	 * A String with the name of the game.
	 * */
	public String getTitle() {
		return title;
	}
	
	/**
	 * Returns a value from the condition scale, for
	 * the cartridge/disc.
	 * <br>
	 * 
	 * @return
	 * String with a value from the condition scale.
	 * */
	public String getCart() {
		return cart;
	}
	
	/**
	 * Returns a value from the condition scale, for
	 * the instructions manual.
	 * <br>
	 * 
	 * @return
	 * String with a value from the condition scale.
	 * */
	public String getInstructions() {
		return instructions;
	}
	
	/**
	 * Returns a value from the condition scale, for
	 * the box.
	 * <br>
	 * 
	 * @return
	 * String with a value from the condition scale.
	 * */
	public String getBox() {
		return box;
	}
	
	/**
	 * Returns a comment for this specific game.
	 * <br>
	 * 
	 * @return
	 * String with the comment.
	 * */
	public String getComment() {
		return comment;
	}
}
